package ink.lovejinhu.leetcode;

import org.junit.Test;

/**
 * @author jinhu
 * created 2021-04-28 16:06
 */
public class Solution_0020 {


    /**
     * @param s
     * @return
     */
    public boolean isValid(String s) {
        if (this.spilt(s).length() == 0) {
            return true;
        }

        return false;
    }

    public String spilt(String s) {
        String[] var = s.split("\\(\\)");
        String value = "";
        for (int i = 0; i < var.length; i++) {
            value = value + var[i];
        }
        String s1 = this.spilt(value);
        String[] var1 = s1.split("\\[\\]");
        String value1 = "";
        for (int i = 0; i < var1.length; i++) {
            value1 = value1 + var1[i];
        }
        String s2 = this.spilt(value1);
        String[] var2 = s2.split("\\{\\}");
        String value2 = "";
        for (int i = 0; i < var2.length; i++) {
            value2 = value2 + var2[i];
        }

        return this.spilt(value2);
    }

    @Test
    public void test() {
       String temp="()[]{}";
       boolean valid = this.isValid(temp);
        System.out.println(valid);
        System.out.println(temp);

    }
}
